package com.benbi.shequapi.controller;


import com.benbi.shequapi.service.ClockinService;
import com.benbi.shequapi.utils.Result;
import org.apache.ibatis.annotations.Param;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

@RestController
@RequestMapping("/clockin")
public class ClockinController {
    @Resource
    ClockinService clockinService;

    @RequestMapping("/getClockin")
    public Result getClockin(@RequestParam("w_pid") int w_pid)
    {
        return clockinService.getClockinByWpid(w_pid);
    }

    @RequestMapping("/addClockin")
    public Result addTask(
            @RequestParam("w_pid")int w_pid,
            @RequestParam("formAddr")String form_addr,
            @RequestParam("business")String business,
            @RequestParam("remark")String remark){
        return clockinService.newClockin(w_pid,form_addr,business,remark);
    }

//    @RequestMapping("/test")
//    public Result test(@RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") Date date){
//        Person p = new Person();
//        p.setBirthdate(date);
//        System.out.println(date);
//        System.out.println(p.getBirthdate());
//        return new Result();
//    }

}
